html2canvas

html2canvas

Screenshots with JavaScript

HTML

<div id="capture" style="padding: 10px; background: #f5da55">
    <h4 style="color: #000; ">Hello world!</h4>
</div>

JavaScript

html2canvas(document.querySelector("#capture")).then(canvas => {
    document.body.appendChild(canvas)
});
Install NPM
npm install --save html2canvas
Install Yarn
yarn add html2canvas
45kb gzipped
Try html2canvas

Try out html2canvas

Test out html2canvas by rendering the viewport from the current page.

Capture